package com.fqxiny.lease.common.exception;

import com.fqxiny.lease.common.result.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author : 戚欣扬
 * @code :
 */
@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(value = Exception.class)
    public Result<Object> handleException(Exception e) {
        e.printStackTrace();
        return Result.fail();
    }

    @ExceptionHandler(UpException.class)
    public Result<Object> handleLeaseException(UpException e) {
        e.printStackTrace();
        return Result.fail(e.getCode(), e.getMessage());
    }
}


